{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "5cbb8ddf-bc86-4da0-96eb-b4971b9bf3a3",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "from bs4 import BeautifulSoup\n",
    "from openai import OpenAI\n",
    "from dotenv import load_dotenv\n",
    "load_dotenv()\n",
    "import requests\n",
    "from IPython.display import Markdown"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "f76bea4c-95cf-47ae-9236-75e866320470",
   "metadata": {},
   "outputs": [],
   "source": [
    "headers = {\n",
    " \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36\"\n",
    "}\n",
    "\n",
    "class Website:\n",
    "    def __init__(self,url):\n",
    "        self.url = url\n",
    "        response = requests.get(self.url, headers)\n",
    "        soup = BeautifulSoup(response.content, 'html.parser')\n",
    "        self.title = soup.title.string if soup.title else \"No title found\"\n",
    "        self.text  = soup.get_text(separator=\" \").lower()       "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "d0ed56fb-af44-42ad-9235-c588ca40edc8",
   "metadata": {},
   "outputs": [],
   "source": [
    "job_search = Website(\"https://www.google.com/about/careers/applications/jobs\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "38468bd0-5d95-4944-b371-107300495ebf",
   "metadata": {},
   "outputs": [],
   "source": [
    "system_prompt = \"You are a job search assistant who finds real-time DevOps-related job listings from career pages, job boards, and developer platforms. Return results with job title, company name, and a link to the listing. Focus on DevOps, SRE, Platform Engineering, and CI/CD tooling roles.\"\n",
    "user_prompt = f\"\"\"\n",
    "Here is a list of job postings:\n",
    "\n",
    "{job_search.text}\n",
    "\n",
    "Please extract only the jobs that are clearly related to:\n",
    "- DevOps\n",
    "- Site Reliability Engineering (SRE)\n",
    "- Platform Engineering\n",
    "- CI/CD or Infrastructure\n",
    "\n",
    "Exclude roles like sales, instructors, analysts, and anything not related to DevOps tools.\n",
    "\n",
    "For each DevOps-related job, return:\n",
    "- Job Title\n",
    "- Company\n",
    "- Location\n",
    "- Years of Experience\n",
    "- Skill set required\n",
    "- (if available) Whether it's remote\n",
    "\"\"\"\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "927af617-0d87-48de-ac0a-751900b4a495",
   "metadata": {},
   "outputs": [],
   "source": [
    "messages = [\n",
    "    { \"role\": \"system\", \"content\": system_prompt },\n",
    "    { \"role\": \"user\", \"content\": user_prompt }\n",
    "]\n",
    "\n",
    "openai = OpenAI(\n",
    "                api_key=os.getenv('GROQ_API_KEY'),\n",
    "                base_url=\"https://api.groq.com/openai/v1\" \n",
    "            )\n",
    "response = openai.chat.completions.create(\n",
    "                model = \"gemma2-9b-it\",\n",
    "                messages = messages\n",
    "            )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "2ded75af-ba51-4e21-a581-d8da82439e2e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Here are the DevOps-related jobs from your provided Google Careers listing:\n",
      "\n",
      "**1.  Technical Lead Manager, Google Notifications** \n",
      "\n",
      "* **Company:** Google \n",
      "* **Location:** Tel Aviv, Israel\n",
      "* **Years of Experience:** 8+ years\n",
      "* **Skillset:** 8+ years of software development experience, 5+ years of experience testing, launching software products, 3+ years of experience with software design and architecture, experience in a leadership role or people management.\n",
      "\n",
      " **2. Senior System Software Engineer, Embedded Systems, Firmware, Pixel**\n",
      "\n",
      "* **Company:** Google \n",
      "* **Location:** New Taipei, Banqiao District, New Taipei City, Taiwan\n",
      "* **Years of Experience:** 5+ years\n",
      "* **Skillset:** 5+ years of experience with software development in C, Android BSP and Linux drivers, 3+ years of experience testing, maintaining, or launching software products, 1+ years of experience with software design and architecture, 3+ years of experience working with embedded operating systems.\n",
      "\n",
      " **3. Senior Technical Program Manager, Infrastructure Deployment Software**\n",
      "\n",
      "* **Company:** Google \n",
      "* **Location:** Sunnyvale, CA, USA\n",
      "* **Years of Experience:** 8+ years\n",
      "* **Skillset:** Bachelor’s Degree in a relevant field, 8+ years of program management experience, 8+ years of infrastructure experience.\n",
      "\n",
      "**4. Network Engineer**\n",
      "\n",
      "* **Company:** Google\n",
      "* **Location:** Bengaluru, Karnataka, India\n",
      "* **Years of Experience:** 3+ years\n",
      "* **Skillset:** Bachelor’s Degree in Computer Science, Engineering, a related field, or equivalent practical experience; 3+ years of experience with network routing protocols, design and troubleshooting, with network equipment providers; Experience with network operations at scale; broad understanding of cloud computing, Linux server environments, network design and deployment, managing large scale infrastructure; experience working in a customer-facing role at an ISP, carrier, content network, or CDN; experience programming in either Python or Go.\n",
      "\n",
      "**5.  Field Activation Lead, Google Cloud**\n",
      "\n",
      "* **Company:** Google \n",
      "* **Location:** Warsaw, Poland\n",
      "* **Years of Experience:** 5+ years\n",
      "* **Skillset:** Bachelor's degree or equivalent practical experience; 5+ years of experience in program or project management in an enterprise, cloud, or technology environment; experience working with executive-level clients or stakeholders.\n",
      "\n",
      "**6. Software Engineer III, Infrastructure, Google Cloud Business Platforms**\n",
      "* **Company:** Google \n",
      "* **Location:** Cambridge, MA, USA\n",
      "* **Years of Experience:** 2+ years \n",
      "* **Skillset:** Bachelor’s degree or equivalent practical experience; 2 years of experience with software development in one or more programming languages (C, C++, Python, or Go), or 1 year of experience with an advanced degree; 2 years of experience with developing large-scale infrastructure, distributed systems or networks, or experience with compute technologies, storage or hardware architecture.\n",
      "\n",
      " **7. Networking Performance Modeling Architect**\n",
      "\n",
      "* **Company:** Google\n",
      "* **Location:** Tel Aviv, Israel; Haifa, Israel\n",
      "* **Years of Experience:** 5+ years\n",
      "* **Skillset:** Bachelor’s degree in Electrical engineering, computer engineering, Computer Science, or equivalent practical experience; 5 years of experience with software development in C++, and data structures/algorithms; experience in performance modeling, performance analysis, and workload characterization.\n",
      "\n",
      "\n",
      "\n",
      "Let me know if you'd like me to search for more specific roles or on other platforms!\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(response.choices[0].message.content)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "6b8bd531-c537-4792-a450-8c06e035172d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "Here are the DevOps-related jobs from your provided Google Careers listing:\n",
       "\n",
       "**1.  Technical Lead Manager, Google Notifications** \n",
       "\n",
       "* **Company:** Google \n",
       "* **Location:** Tel Aviv, Israel\n",
       "* **Years of Experience:** 8+ years\n",
       "* **Skillset:** 8+ years of software development experience, 5+ years of experience testing, launching software products, 3+ years of experience with software design and architecture, experience in a leadership role or people management.\n",
       "\n",
       " **2. Senior System Software Engineer, Embedded Systems, Firmware, Pixel**\n",
       "\n",
       "* **Company:** Google \n",
       "* **Location:** New Taipei, Banqiao District, New Taipei City, Taiwan\n",
       "* **Years of Experience:** 5+ years\n",
       "* **Skillset:** 5+ years of experience with software development in C, Android BSP and Linux drivers, 3+ years of experience testing, maintaining, or launching software products, 1+ years of experience with software design and architecture, 3+ years of experience working with embedded operating systems.\n",
       "\n",
       " **3. Senior Technical Program Manager, Infrastructure Deployment Software**\n",
       "\n",
       "* **Company:** Google \n",
       "* **Location:** Sunnyvale, CA, USA\n",
       "* **Years of Experience:** 8+ years\n",
       "* **Skillset:** Bachelor’s Degree in a relevant field, 8+ years of program management experience, 8+ years of infrastructure experience.\n",
       "\n",
       "**4. Network Engineer**\n",
       "\n",
       "* **Company:** Google\n",
       "* **Location:** Bengaluru, Karnataka, India\n",
       "* **Years of Experience:** 3+ years\n",
       "* **Skillset:** Bachelor’s Degree in Computer Science, Engineering, a related field, or equivalent practical experience; 3+ years of experience with network routing protocols, design and troubleshooting, with network equipment providers; Experience with network operations at scale; broad understanding of cloud computing, Linux server environments, network design and deployment, managing large scale infrastructure; experience working in a customer-facing role at an ISP, carrier, content network, or CDN; experience programming in either Python or Go.\n",
       "\n",
       "**5.  Field Activation Lead, Google Cloud**\n",
       "\n",
       "* **Company:** Google \n",
       "* **Location:** Warsaw, Poland\n",
       "* **Years of Experience:** 5+ years\n",
       "* **Skillset:** Bachelor's degree or equivalent practical experience; 5+ years of experience in program or project management in an enterprise, cloud, or technology environment; experience working with executive-level clients or stakeholders.\n",
       "\n",
       "**6. Software Engineer III, Infrastructure, Google Cloud Business Platforms**\n",
       "* **Company:** Google \n",
       "* **Location:** Cambridge, MA, USA\n",
       "* **Years of Experience:** 2+ years \n",
       "* **Skillset:** Bachelor’s degree or equivalent practical experience; 2 years of experience with software development in one or more programming languages (C, C++, Python, or Go), or 1 year of experience with an advanced degree; 2 years of experience with developing large-scale infrastructure, distributed systems or networks, or experience with compute technologies, storage or hardware architecture.\n",
       "\n",
       " **7. Networking Performance Modeling Architect**\n",
       "\n",
       "* **Company:** Google\n",
       "* **Location:** Tel Aviv, Israel; Haifa, Israel\n",
       "* **Years of Experience:** 5+ years\n",
       "* **Skillset:** Bachelor’s degree in Electrical engineering, computer engineering, Computer Science, or equivalent practical experience; 5 years of experience with software development in C++, and data structures/algorithms; experience in performance modeling, performance analysis, and workload characterization.\n",
       "\n",
       "\n",
       "\n",
       "Let me know if you'd like me to search for more specific roles or on other platforms!\n"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(Markdown(response.choices[0].message.content))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c6bd6d14-e0df-45be-99e2-55aa4d96f53b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
